package com.honghh.controller;

import com.honghh.entity.User;
import com.honghh.repository.UserRepository;
import com.honghh.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * description:
 *
 * @author: hh
 * @date: 2018/6/8 13:57
 */
@RestController
public class UserController {

    @Autowired
    UserRepository userRepository;

    /**
     * 获取用户信息
     *
     * @param username
     * @return
     */
    @RequestMapping(value = "findUser", method = RequestMethod.POST)
    public R description(String username) {

        User user = userRepository.findByUsername(username);

        return R.ok(user.toString());
    }
}
